﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetDon.OA.Interface;
using NetDon.Utilities;

namespace NetDon.OA.Business
{
    public class OApplicationContext : ApplicationContext
    {
        /// <summary>
        /// Gets or sets the accessing function.
        /// </summary>
        /// <value>The accessing function.</value>
        public virtual string AccessingFunction
        {
            get { return (string)this["AccessingFunction"]; }
            set { this["AccessingFunction"] = value; }
        }

        /// <summary>
        /// Gets or sets the permit functions.
        /// </summary>
        /// <value>The permit functions.</value>
        public virtual string[] FunctionPermission
        {
            get { return (string[])this["FunctionPermission"]; }
            internal set { this["FunctionPermission"] = value; }
        }

        public virtual Guid StaffId
        {
            get { return (Guid)this["StaffId"]; }
            set { this["StaffId"] = value; }
        }
        public virtual Guid? DepartId
        {
            get
            {
                if (this["DepartId"] != null)
                    return (Guid)this["DepartId"];
                return Guid.Empty;
            }
            set { this["DepartId"] = value; }
        }
        public virtual Guid CompanyId
        {
            get
            {
           
                if (this["CompanyId"] != null)
                    return (Guid)this["CompanyId"];
                return Guid.Empty;
            }
            set { this["CompanyId"] = value; }
        }


        public virtual string CompanyName
        {
            get
            {
                if (this["CompanyName"] != null)
                    return this["CompanyName"].ToString();
                return string.Empty;
    
            }
            internal set { this["CompanyName"] = value; }
        }
        public virtual string DepartName
        {
            get { return this["DepartName"].ToString(); }
            internal set { this["DepartName"] = value; }
        }
        public virtual string FullName
        {
            get { return this["FullName"].ToString(); }
            set { this["FullName"] = value; }
        }



        public virtual Guid? PositionId
        {
            get { return (Guid)this["PositionId"]; }
            set { this["PositionId"] = value; }
        }
        public virtual Guid? RoleId
        {
            get { return (Guid)this["RoleId"]; }
            set { this["RoleId"] = value; }
        }

        public virtual BusinessType BusinessType
        {
            get
            {
                if (this["BusinessType"] != null)
                    return (BusinessType)Enum.Parse(typeof(BusinessType), this["BusinessType"].ToString());
                return BusinessType.A;
            }
            set { this["BusinessType"] = value; }
        }

    }
}
